@include('admin.header')

<style type="text/css">
  .opartion {
    width: 350px;
  }

  .pagination {
    list-style: none;
    float: right;
  }

  .pagination li {
    float: left;
    padding-left: 5px;
    padding-right: 5px;
  }

  .input_search {
    margin-top: 10px;
  }
</style>

<div class="wrap">
  <div class="margin-bottom-20">
    <!-- <a class="btn btn-primary edit"><i class="fa fa-plus"></i> 添加</a> -->
    {{ csrf_field() }}
    <input id="change_url" value="" type="hidden"/>
    <form action="{{url('wallet/statechange')}}" method="post">
        <div class="cl pd-5 bg-1 bk-gray mt-20">
         锁定钱包编号：
       <input type="text" style="width: 200px;height: 35px;" name="lockid" value="{{$lock_id or ''}}"/>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
       
         操作员账号：
       <input type="text" style="width: 200px;height: 35px;" name="operatorcode" value="{{$operatorcode or ''}}"/>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            <button name="" id="search" class="btn btn-success user_search" type="
            submit"><i class="Hui-iconfont"></i> 搜索</button>
            </span>
            <span class="r">共有数据：<strong>{{$data->total()}}</strong> 条</span>
        </div>
    </form>
  </div>
  <form class="form-horizontal js-ajax-form" method="post" novalidate="novalidate">
    <table class="table table-hover table-bordered">
      <thead>
      <tr>
        <th>锁定编号</th>
        <th>账户编号</th>
        <th>账户类型</th>
        <th>拥有者类型</th>
        <th>拥有者姓名</th>
        <th>拥有者账号</th>
        <th>锁定前状态 </th>
        <th>锁定后状态</th> 
        <th>操作员编号</th>
        <th>操作员账号</th>
        <th>操作员名称</th>
        <th>操作时间</th>
        <!-- <th>操作</th> -->
      </tr>
      </thead>
      <tbody>
      @foreach($data as $val)
      <tr>
        <td>{{$val->lock_id}}</td>
        <td>{{$val->purse_id}}</td>
        <td>
          @if($val->pursetype == 0)
              <span>None</span>
          @elseif($val->pursetype == 1)
              <span>收益账户</span>
          @elseif($val->pursetype == 2)
              <span>现金账户</span>
          @elseif($val->pursetype == 3)
              <span>积分账户</span>
          @elseif($val->pursetype == 4)
              <span>o2o收益账户</span>    
          @elseif($val->pursetype == 96)
              <span>过账账户</span>    
          @elseif($val->pursetype == 97)
              <span>授信账户</span>    
          @elseif($val->pursetype == 98)
              <span>中央银行账户</span>            
          @else
              <span>系统收益账户</span>    
          @endif
        </td>
        <td>
          @if($val->ownertype == 0)
              <span>None</span>
          @elseif($val->ownertype == 1)
              <span>用户账户</span>
          @elseif($val->ownertype == 2)
              <span>商家账户</span>
          @elseif($val->ownertype == 3)
              <span>企业账户</span>
          @else
              <span>系统账户</span>    
          @endif
        </td>

         <td>{{$val->ownername}}</td>
         <td>{{$val->ownercode}}</td>
        <td>
          @if(isset($val->bstatus[0]) && $val->bstatus[0] == 0)
              <span>全部容许</span>
          @elseif(isset($val->bstatus[4]) && $val->bstatus[4] == -1)
              <span>全部禁止</span>
          @elseif($val->bstatus[0] == 1 && $val->bstatus[1] == '')
              <span>禁止进账</span>
          @elseif($val->bstatus[0] == 2 && $val->bstatus[1] == '')
              <span>禁止出账</span>
          @elseif($val->bstatus[0] == 4 && $val->bstatus[1] == '')
              <span>禁止冻结</span>
          <!--1 2 4-->    
          @elseif($val->bstatus[0]== 1 && $val->bstatus[1] == 2 && $val->bstatus[2] == 4)
              <span>禁止进账,禁止出账,禁止冻结</span>
          @elseif($val->bstatus[0]== 1 && $val->bstatus[1] == 2 && $val->bstatus[2]=='')
              <span>禁止进账,禁止出账</span>
          @elseif($val->bstatus[0]== 1 && $val->bstatus[1] == 4 && $val->bstatus[2]=='')
              <span>禁止进账,禁止冻结</span>
          @elseif($val->bstatus[0]== 2 && $val->bstatus[1] == 4 && $val->bstatus[2]=='')
              <span>禁止出账,禁止冻结</span>
          @elseif($val->bstatus[0]== 1 && $val->bstatus[1] == 8 && $val->bstatus[2]=='') 
              <span>禁止进账,禁止解冻</span>
          @elseif($val->bstatus[0]== 4 && $val->bstatus[1] == 8 && $val->bstatus[2]=='') 
              <span>禁止冻结,禁止解冻</span>
          <!--1 2 8-->
         @elseif($val->bstatus[0]== 1 && $val->bstatus[1] == 2 && $val->bstatus[2] == 8)
              <span>禁止进账,禁止出账,禁止解冻</span>

         <!--1 4 8-->
         @elseif($val->bstatus[0]== 1 && $val->bstatus[1] == 4 && $val->bstatus[2] == 8)
              <span>禁止进账,禁止冻结,禁止解冻</span>      

          @elseif($val->bstatus[0]== 2 && $val->bstatus[1] == 4 && $val->bstatus[2] == 8)
              <span>禁止出账,禁止冻结,禁止解冻</span>
          @elseif($val->bstatus[0]== 2 && $val->bstatus[1] == 4 && $val->bstatus[2]=='')
              <span>禁止出账,禁止冻结</span>
          @elseif($val->bstatus[0]== 2 && $val->bstatus[1] == 8 && $val->bstatus[2]=='')
              <span>禁止出账,禁止解冻</span>
          @elseif($val->bstatus[0]== 4 && $val->bstatus[1] == 8 && $val->bstatus[2]=='')
              <span>禁止冻结,禁止解冻</span>                
          @else
              <span>禁止解冻</span>    
          @endif
        </td>

                <td>
          @if(isset($val->astatus[0]) && $val->astatus[0] == 0)
              <span>全部容许</span>
          @elseif(isset($val->astatus[4]) && $val->astatus[4] == -1)
              <span>全部禁止</span>
          @elseif($val->astatus[0] == 1 && $val->astatus[1] == '')
              <span>禁止进账</span>
          @elseif($val->astatus[0] == 2 && $val->astatus[1] == '')
              <span>禁止出账</span>
          @elseif($val->astatus[0] == 4 && $val->astatus[1] == '')
              <span>禁止冻结</span>
          <!--1 2 4-->    
          @elseif($val->astatus[0]== 1 && $val->astatus[1] == 2 && $val->astatus[2] == 4)
              <span>禁止进账,禁止出账,禁止冻结</span>
          @elseif($val->astatus[0]== 1 && $val->astatus[1] == 2 && $val->astatus[2]=='')
              <span>禁止进账,禁止出账</span>
          @elseif($val->astatus[0]== 1 && $val->astatus[1] == 4 && $val->astatus[2]=='')
              <span>禁止进账,禁止冻结</span>
          @elseif($val->astatus[0]== 2 && $val->astatus[1] == 4 && $val->astatus[2]=='')
              <span>禁止出账,禁止冻结</span>
          @elseif($val->astatus[0]== 1 && $val->astatus[1] == 8 && $val->astatus[2]=='') 
              <span>禁止进账,禁止解冻</span>
          @elseif($val->astatus[0]== 4 && $val->astatus[1] == 8 && $val->astatus[2]=='') 
              <span>禁止冻结,禁止解冻</span>
          <!--1 2 8-->
         @elseif($val->astatus[0]== 1 && $val->astatus[1] == 2 && $val->astatus[2] == 8)
              <span>禁止进账,禁止出账,禁止解冻</span>

         <!--1 4 8-->
         @elseif($val->astatus[0]== 1 && $val->astatus[1] == 4 && $val->astatus[2] == 8)
              <span>禁止进账,禁止冻结,禁止解冻</span>      

          @elseif($val->astatus[0]== 2 && $val->astatus[1] == 4 && $val->astatus[2] == 8)
              <span>禁止出账,禁止冻结,禁止解冻</span>
          @elseif($val->astatus[0]== 2 && $val->astatus[1] == 4 && $val->astatus[2]=='')
              <span>禁止出账,禁止冻结</span>
          @elseif($val->astatus[0]== 2 && $val->astatus[1] == 8 && $val->astatus[2]=='')
              <span>禁止出账,禁止解冻</span>
          @elseif($val->astatus[0]== 4 && $val->astatus[1] == 8 && $val->astatus[2]=='')
              <span>禁止冻结,禁止解冻</span>                
          @else
              <span>禁止解冻</span>    
          @endif
        </td>

         <td>{{$val->op_node_id}}</td>
         <td>{{$val->operatorcode}}</td>
         <td>{{$val->operatorname}}</td>
         <td>{{$val->create_time}}</td>
        <td>
          <!-- <span><a _id="{{$val->purseid}}" class="dj_money">详情</a></span>  -->
         
        </td>
      </tr>
      @endforeach
      </tbody>
    </table>

    <!-- 分页 -->
    @if (!empty($data))
    <div class="page_list">
        {{$data->links()}}
    </div>
    @endif
  </form>
</div>

<script>
$(function(){
      //添加钱包账户
    $('#add_wallet').click(function() {
      open_iframe_layer('/wallet/add_wallet?id='+'add');
    });

    //冻结资金
    $('.dj_money').click(function() {
      var id = $(this).attr('_id') || 0;
      open_iframe_layer('/wallet/block_money?purseid='+id);
    });

    //变动历史
    $('.change_history').click(function() {
      var id = $(this).attr('_id') || 0;
      open_iframe_layer('/wallet/change_history?purseid='+id);
    });

   //流水统计
    $('.flow_statistics').click(function() {
      var id = $(this).attr('_id') || 0;
      open_iframe_layer('/wallet/flow_statistics?purseid='+id);
    }); 
    //锁定/解锁
    $('.lock_unlock').click(function() {
      var id = $(this).attr('_id') || 0;
      open_iframe_layer('/wallet/lock_unlock?purseid='+id);
    });

    $('.js-rule-delete').click(function(){
    var id = $(this).attr('rel');
    layer.confirm('你确定要删除吗？', {
      btn: ['确定','取消']
    }, function(){
      $.post('{{asset("basiconfig/del")}}',{id:id},function (msg) {
        if(msg.status == 1){
          layer.alert(msg.info, {
            title: '提示',
            icon: 1,
          });
          window.location.href = '{{asset("basiconfig/transfer_rule")}}';
        }else{
          layer.alert(msg.info, {
            title: '提示',
            icon: 2,
          });
        }
      },'json');
    },function() {

    });
  });
});
//详情
// $('.apply_action').click(function() {
//   var id = $(this).attr('_id');
//    if(confirm("确定要审核通过吗？")){
//       $.ajax({
//             type: 'GET',
//             url: '/system/apply_action?id='+id,
//             dataType: 'json',
//             success: function(data){
               
//             },
           
//          });
//    }
        
//    });


</script>